{% extends 'TopxiaAdminBundle::layout.html.twig' %}
{% block title %}激活码管理{% endblock %}


{% set script_controller = 'activema/activema' %}


{% block content %}
{{ web_macro.flash_messages() }}
<div class="well well-sm mtl">
    <form id="activema-build-form" class="form-inline" action="{{ path('admin_activema_build') }}" method="get" novalidate="">
      <div class="form-group">
        <input style="max-width:150px;" class="form-control" type="text" placeholder="数量" name="num" value="">
      </div>
      <div class="form-group">
        <input style="max-width:150px;" class="form-control" type="text" placeholder="有效期（月）" name="stime" value="">
      </div>
      <div class="form-group">
        <input style="max-width:100px;" class="form-control" type="text" placeholder="合作商" name="hezuoshang" value="">
      </div>
      <button class="btn btn-primary">生成</button>
    <a href="{{ path('admin_activema_try') }}" class="btn" style="float:right;">试用用户</a>
    </form>
</div>
<div class="well well-sm mtl">
    <form id="activema-search-form" class="form-inline" action="" method="get" novalidate="">
      <div class="form-group">
        <input style="max-width:150px;" class="form-control" type="text" placeholder="激活码" name="activema" value="{{ app.request.get('activema') }}">
      </div>
      <div class="form-group">
        <input style="max-width:150px;" class="form-control" type="text" placeholder="网卡码" name="mac" value="{{ app.request.get('mac') }}">
      </div>
      <div class="form-group">
        <input style="max-width:100px;" class="form-control" type="text" placeholder="合作商" name="hezuoshang" value="{{ app.request.get('hezuoshang') }}">
      </div>
      <div class="form-group">
        <input style="max-width:100px;" class="form-control" type="text" placeholder="起始日期" name="starttime" value="{{ app.request.get('starttime') }}">—
        <input style="max-width:100px;" class="form-control" type="text" placeholder="结束日期" name="endtime" value="{{ app.request.get('endtime') }}">
      </div>
      <div class="form-group">
        <input style="max-width:150px;" class="form-control" type="text" placeholder="地区" name="area" value="{{ app.request.get('area') }}">
      </div>
      <button class="btn btn-primary">搜索</button>

    </form>
</div>
<form id="activema-form" class="form-inline" action="{{ path('admin_activema_set') }}" method="get" novalidate="">
<table class = 'table table-striped table-hover'>
<thead>
    <tr>
        <th><input type='checkbox' data-role="batch-select" /></th><th>ID</th><th>激活码</th><th>网卡码</th><th>状态</th><th>激活日期</th><th>有效期</th>
	<th>到期日期</th><th>合作商</th><th>姓名</th><th>手机号</th><th>QQ号</th><th>地区</th>
    </tr>
</thead>
<tbody>
{% for activema in activemas %}
    <tr>
	<td><input type='checkbox' name='ids[]' value = '{{activema.id}}' data-role="batch-item" /></td>
        <td>{{ activema.id }}</td>
        <td>{{ activema.activema }}</td>
        <td>{{ activema.mac }}</td>
        <td><input type = "checkbox" disabled value = '1' {% if activema.status == 1 %} checked {% endif %}</td>
        <td>{{ activema.starttime }}</td>
        <td>{{ activema.validity }}</td>
        <td>{{ activema.endtime }}</td>
        <td>{{ activema.hezuoshang }}</td>
        <td>{{ activema.xingming }}</td>
        <td>{{ activema.mobile }}</td>
        <td>{{ activema.qq }}</td>
        <td>{{ activema.area }}</td>
    </tr>
{% else %}
    <tr><td colspan="15"><div class="empty">暂无激活码记录</div></td></tr>
{% endfor %}
    <tr><td colspan="15"><div class="empty" style="padding:0px;">共：{{counttype.zong}}个　　　　已激活：{{ counttype.jihuo }}个　　　　未激活：{{counttype.weijihuo}}个</div></td></tr>
</tbody>
</table>
<div class="form-group">
    <input style="max-width:150px;" class="form-control" type="text" placeholder="有效期（月）" name="validity" id="validity" value="">
</div>
<button class="btn btn-primary" id="active-set" name="set" value="1" onclick="submit_type = 'set';">批量设置</button>
<button class="btn" id="active-reset" name="reset" value="1" onclick="submit_type = 'reset';">批量重置</button>
</form>
{{ web_macro.paginator(paginator) }}
{% endblock %}